/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package EDT.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author ali
 */
public class AjoutCreneauForm extends org.apache.struts.action.ActionForm {
    
   
private String key;
private int promo;
private String type;
private int gp;
private int ec;
private int interv;
private int salle;
private int debut;
private int fin;
private String jour;
private int nbrCr;
private String visible;
private int nbrPeriode;

    public String getVisible() {
        return visible;
    }

    public void setVisible(String visible) {
        this.visible = visible;
    }

    public int getNbrCr() {
        return nbrCr;
    }

    public void setNbrCr(int nbrCr) {
        this.nbrCr = nbrCr;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }



    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getGp() {
        return gp;
    }

    public void setGp(int gp) {
        this.gp = gp;
    }

    public int getEc() {
        return ec;
    }

    public void setEc(int ec) {
        this.ec = ec;
    }

    public int getInterv() {
        return interv;
    }

    public void setInterv(int interv) {
        this.interv = interv;
    }

    public int getSalle() {
        return salle;
    }

    public void setSalle(int salle) {
        this.salle = salle;
    }

    public int getDebut() {
        return debut;
    }

    public void setDebut(int debut) {
        this.debut = debut;
    }

    
     public int getPromo() {
        return promo;
    }

    public void setPromo(int promo) {
        this.promo = promo;
    }
    public int getFin() {
        return fin;
    }

    public void setFin(int fin) {
        this.fin = fin;
    }

    public String getJour() {
        return jour;
    }

    public void setJour(String jour) {
        this.jour = jour;
    }

    public int getNbrPeriode() {
        return nbrPeriode;
    }

    public void setNbrPeriode(int nbrPeriode) {
        this.nbrPeriode = nbrPeriode;
    }

    @Override
    public String toString() {
        return "AjoutCreneauForm{" + "key=" + key + ", promo=" + promo + ", type=" + type + ", gp=" + gp + ", ec=" + ec + ", interv=" + interv + ", salle=" + salle + ", debut=" + debut + ", fin=" + fin + ", jour=" + jour + ", nbrCr=" + nbrCr + '}';
    }


    /**
     *
     */
    public AjoutCreneauForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * This is the action called from the Struts framework.
     *
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getInterv() == 0 || getInterv() < 1) {
            errors.add("name", new ActionMessage("error.name.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        
        if (getSalle() == 0 || getSalle() < 1) {
            errors.add("name", new ActionMessage("error.name.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        return errors;
    }
}
